package com.movecar.ui;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.movecar.R;
import com.movecar.utils.AppConfig;

/**
 * 更多-关于我们
 * 
 * @author Zhao.JQ
 * 
 */
public class AboutUsActivity extends Activity implements OnClickListener {
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.more_about_us);
		initView();
	}

	private void initView() {
		findViewById(R.id.mPhone).setOnClickListener(this);
		findViewById(R.id.user_layout).setOnClickListener(this);
		findViewById(R.id.mWeb).setOnClickListener(this);
		Button back = (Button) findViewById(R.id.btn_left);
		back.setVisibility(View.VISIBLE);
		back.setOnClickListener(this);
		TextView title = (TextView) findViewById(R.id.title);
		title.setText("关于应用");
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_left:
			finish();
			break;
		case R.id.mPhone:
			AlertDialog dialog = new AlertDialog.Builder(AboutUsActivity.this)
					.setTitle("拨号")
					.setPositiveButton("确定",
							new DialogInterface.OnClickListener() {

								@Override
								public void onClick(DialogInterface dialog,
										int which) {
									Intent intent = new Intent(
											Intent.ACTION_CALL,
											Uri.parse("tel:"
													+ AppConfig.CUSTOM_PHONE));
									startActivity(intent);
									dialog.dismiss();
								}
							})
					.setNegativeButton("取消",
							new DialogInterface.OnClickListener() {

								@Override
								public void onClick(DialogInterface dialog,
										int which) {
									dialog.dismiss();
								}
							}).setMessage("拨打: " + AppConfig.CUSTOM_PHONE)
					.create();
			dialog.show();
			break;
		case R.id.mWeb:
			Uri uri = Uri.parse("http://www.fuyunlehe.com/");
			Intent intent = new Intent(Intent.ACTION_VIEW, uri);
			startActivity(intent);
			break;
		case R.id.user_layout:
			startActivity(new Intent(getApplicationContext(),
					ProtocolShowActivity.class));
			break;

		default:
			break;
		}

	}
}
